package com.qk.mapper;

import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface CourseMapper {
    //查询课程信息列表
    List<Course> selectList(String name, Integer subject, Integer target);


    @Delete("delete from course where id=#{id}")
    void deleteById(Integer id);

    @Insert("insert into course(name,subject,price,target,description,create_time,update_time) values(#{name},#{subject},#{price},#{target},#{description},#{createTime},#{updateTime})")
    void insert(Course course);

    @Select("select * from course where id= #{id}")
    Course selectById(Integer id);

    @Update("update course set name=#{name},subject=#{subject},price=#{price},target=#{target},description=#{description},update_time=#{updateTime} where id=#{id}")
    void updateById(Course course);

    @Select("select * from course")
    List<Course> selectAll();

    @Select("select * from course where subject= #{subject}")
    List<Course> listBySubject(Integer subject);
}
